﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.OleDb;

/// <summary>
///AccessSchema 的摘要说明
/// </summary>
public class AccessSchema:IDBSchema
{
	public AccessSchema()
	{
		
	}

    #region IDBSchema 成员

    public System.Collections.IEnumerable GetTablesInDB()
    {
        OleDbConnection conn = DBFactory.GetConn().Connection as OleDbConnection;
        if (conn.State != System.Data.ConnectionState.Open)
        { conn.Open(); }

        return conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "Table" }).DefaultView;
    }

    public System.Collections.IEnumerable GetColumnsInTable(string TableName)
    {
        OleDbConnection conn = DBFactory.GetConn().Connection as OleDbConnection;
        if (conn.State != System.Data.ConnectionState.Open)
        { conn.Open(); }

        return conn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new object[] { null, null, TableName }).DefaultView;
    }

    #endregion

    #region IDBSchema 成员


    public System.Collections.IEnumerable GetViewsInDB()
    {
        OleDbConnection conn = DBFactory.GetConn().Connection as OleDbConnection;
        if (conn.State != System.Data.ConnectionState.Open)
        { conn.Open(); }
        return conn.GetOleDbSchemaTable(OleDbSchemaGuid.Views, null).DefaultView;
    }

    #endregion
}
